package com.caigou.comm.base.ext

import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LiveData

/**
 * @author #Suyghur.
 * Created on 2021/09/14
 */

fun <T> LifecycleOwner.observe(liveData: LiveData<T>, action: (t: T) -> Unit) {
    liveData.observe(this, { it?.let { t -> action(t) } })
}